﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace Model
{
    [Table("Delivery")]
    public class Delivery : BaseModel
    {
        public string DeliveryNo { get; set; }
        public DateTime? DeliveryDate { get; set; }
        public int? VehicleId { get; set; }
        public TimeSpan? StartTime { get; set; }
        public string OtherInformation { get; set; }
        public string Status { get; set; }

        public string IsSendSms { get; set; }

        public string IsSendEmail { get; set; }

        public int? StaffId { get; set; }

        public virtual User Staff { get; set; }

        public virtual Vehicle Vehicle { get; set; }
        public virtual ICollection<DeliveryDetail> Details { get; set; }

        [NotMapped]
        public string VehicleName
        {
            get
            {
                if (VehicleId.HasValue)
                {
                    return Vehicle.Name;
                }
                return string.Empty;
            }
        }
    }

    [NotMapped]
    public class DeliveryStatus
    {
        public string Status { get; set; }
        public string Error { get; set; }
    }

    [NotMapped]
    public class DeliveryTemplate
    {
        public int Id { get; set; }

        public string Vehicle { get; set; }
        public string DeliveryNo { get; set; }
        public DateTime? DeliveryDate { get; set; }
        public TimeSpan? StartTime { get; set; }
        public string Status { get; set; }

    }
}
